<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$_SESSION['onemerchid']=0;
	$return['pluginset']['toplogo']=tomedia($return['pluginset']['toplogo']);
	$return['pluginset']['ewm_logo']=tomedia($return['pluginset']['ewm_logo']);
	foreach($return['pluginset']['gongsis'] as &$item){
		$item['img']=tomedia($item['img']);
	}
	foreach($return['pluginset']['indexcube'] as &$item){
		$item['image']=tomedia($item['image']);
	}
	$return['setting']=$return['pluginset'];
	$title=$return['pluginset']['share_title']?:$return['pluginset']['title'];
	$desc=$return['pluginset']['share_desc'];
	$logo=$return['pluginset']['share_image'];
	$return['member']=cfc('core')->get_member($_SESSION['uid']);
	$sharelink='jy_kuaidisys/index//fromuser='.$_SESSION['uid'];
	$return['sharedata']=array(
			'title'=>$title?:'在线发快递',
			'desc'=>$desc?:'在线发快递！享优惠！',
			'link'=>custom_url($sharelink,true),
			'imgUrl'=>tomedia($logo),
	);
	$return['list']=array();
	$return['pcd']=array();
	$return['params']['pid']=intval($_RQ['pid']);
	$return['time']=time();
	set_html('title',$title);
	exi($return);
}
if($_RQ['op']=='gettanmus'){
	$params=array('uniacid'=>$_SESSION['uniacid']);
	$pindex = max(1, intval($_RQ['page']));
	$psize = 20;
	$total='';
	$fields=array('id','mid','status');
	$list=pdo_getslice('jy_kuaidisys_jilog',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	if(count($list)<20){
		$params=array('uniacid'=>$_SESSION['uniacid'],'is_virtual'=>1);
		$psize = 20-count($list);
		$fields=array('id','avatar','nickname','username');
		$list=pdo_getslice('core_members',$params,array($pindex,$psize),$total,$fields,'','id desc');
	}
	foreach($list as &$item){
		if($item['mid']){
			$member=cfc('core')->member_show($item['mid']);
		}else{
			$member['nickname']=$item['username'];
		}
		$member['nickname']=mb_substr($member['nickname'],0,2,'utf-8').'***';
		$item['title']='恭喜'.$member['nickname'].'寄件成功，你也快来便宜寄快递吧！';
		$member['avatar']=$member['avatar']?:'../core/resource/images/nopic.jpg';
		$item['avatar']=tomedia($member['avatar']);
	}
	$return['list']=$list;
	exi($return);
}
?>